package cn.isjinhao.se.sql.grammar.statement.update.represention;

import cn.isjinhao.se.sql.grammar.CurdStatement;
import cn.isjinhao.se.sql.grammar.CurdStatementVisitor;
import cn.isjinhao.se.sql.grammar.statement.update.SingleUpdateMetaInfo;
import cn.isjinhao.se.sql.lexical.token.Token;

/**
 * @author 01395265
 * @date 2021/4/6
 */
public class Update extends CurdStatement {

    private SingleUpdateMetaInfo singleUpdateMetaInfo;

    private Token tableName;

    private CurdStatement assignmentList;

    private CurdStatement whereSeg;

    public Update(Token tableName, CurdStatement assignmentList, CurdStatement whereSeg) {
        this.tableName = tableName;
        this.assignmentList = assignmentList;
        this.whereSeg = whereSeg;
    }

    @Override
    public <R> R accept(CurdStatementVisitor<R> curdStatementVisitor) {
        return curdStatementVisitor.visitUpdate(this);
    }

    public Token getTableName() {
        return tableName;
    }

    public CurdStatement getAssignmentList() {
        return assignmentList;
    }

    public CurdStatement getWhereSeg() {
        return whereSeg;
    }

    public void setSingleUpdateMetaInfo(SingleUpdateMetaInfo singleUpdateMetaInfo) {
        this.singleUpdateMetaInfo = singleUpdateMetaInfo;
    }
}
